//
//  HLSessionDataProovider.m
//  YueYue
//
//  Created by hulu001 on 2023/6/12.
//

#import "HLSessionDataProovider.h"

@implementation HLSessionDataProovider


- (void)pullDown:(NIMMessage *)firstMessage session:(NIMSession *)session handler:(HLIMKitDataProvideHandler)handler
{
    // TODO: 下拉刷新
    NIMHistoryMessageSearchOption *searchOpt = [[NIMHistoryMessageSearchOption alloc] init];
    searchOpt.startTime  = 0;
    searchOpt.endTime    = firstMessage.timestamp;
    searchOpt.currentMessage = firstMessage;
    searchOpt.limit      = 10;
    searchOpt.sync       =  YES;
    
    [NIMSDK.sharedSDK.conversationManager fetchMessageHistory:session option:searchOpt result:^(NSError * _Nullable error, NSArray<NIMMessage *> * _Nullable messages) {
        handler(error, messages);
    }];
}

- (void)loadNew:(NIMMessage *)endMessage session:(NIMSession *)session handler:(HLIMKitDataProvideHandler)handler
{
}

@end
